package org.example.api.admin;

import org.example.R.R;
import org.example.entity.dto.EditBasicInformationDto;
import org.example.entity.dto.EditPartyOrganizationInfoDto;
import org.example.service.PartyBuildingGuidanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 党建指导
 */

@RestController
@RequestMapping("/api/admin/dj")
public class PartyBuildingGuidanceController {


    @Autowired
    private PartyBuildingGuidanceService partyBuildingGuidanceService;
    @PostMapping("/importExcelToTable")
    public R importExcelToTable(@RequestParam("excelFile") MultipartFile excelFile,@RequestParam("tableName") String tableName) {
        return partyBuildingGuidanceService.importExcelToTable(excelFile,tableName);
    }
    @PostMapping("/tableInfo")
    public R getTableInfo(@RequestParam("tableName")String tableName){
        return partyBuildingGuidanceService.getTableInfo(tableName);
    }
    @PostMapping("/delete")
    public R deleteElement(@RequestParam("tableName")String tableName,@RequestParam("id")Long id){
        return partyBuildingGuidanceService.deleteElement(tableName,id);
    }
    @PostMapping("/groupInfo")
    public R groupInfo(){
        return partyBuildingGuidanceService.groupInfo();
    }
    @PostMapping("/edit")
    public R update(@RequestBody EditPartyOrganizationInfoDto dto) {
        return partyBuildingGuidanceService.edit(dto);
    }




}
